<?xml version="1.0" encoding="UTF-8"?>
<ui:composition xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html"
	template="/WEB-INF/templates/default.xhtml">
	<ui:define name="content">
		<h3>Vehicles</h3>

		<h:form id="selectVehicle" rendered="#{!login.admin}">
			<h:panelGroup rendered="#{empty vehicleController.vehicles}">
				<em>No results.</em>
			</h:panelGroup>
			<h:dataTable var="_vehicle" value="#{vehicleController.vehicles}" rendered="#{not empty vehicleController.vehicles}" styleClass="simpletablestyle">
				<h:column>
					<f:facet name="header">Make</f:facet>
                #{_vehicle.vehicleModel.vehicleMake.makeName}
            </h:column>

				<h:column>
					<f:facet name="header">Model</f:facet>
                #{_vehicle.vehicleModel.modelName}
            </h:column>
				<h:column>
					<f:facet name="header">Modification</f:facet>
                #{_vehicle.vehicleModification.modificationName}
            </h:column>
				<h:column>
					<f:facet name="header">Color</f:facet>
                #{_vehicle.color.colorName}
            </h:column>
				<h:column>
					<f:facet name="header">VIN</f:facet>
                #{_vehicle.vin}
            </h:column>
				<h:column>
					<f:facet name="header">Plate Number</f:facet>
                #{_vehicle.plateNumber}
            </h:column>
				<h:column>
					<f:facet name="header">action</f:facet>
					<h:commandLink action="#{vehicleController.selectVehicle(_vehicle)}" value="Go to maintenances" />
				</h:column>
			</h:dataTable>
		</h:form>
			<h:form>
				<h:commandLink action="#{login.logout()}" value="Logout" />
			</h:form>

	</ui:define>
</ui:composition>
